//
//  BuildingsSearchViewController.m
//  Utils
//
//  Created by enghou on 2018/4/28.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "BuildingsSearchViewController.h"

@interface BuildingsSearchViewController ()

@end

@implementation BuildingsSearchViewController


-(NSDictionary *)param{
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    [param setObject:self.buildingAddressField.text forKey:@"builddatasSearchVo.buildingaddress"];
    [param setObject:self.structureModel.ids forKey:@"builddatasSearchVo.buildingstructuresId"];
    [param setObject:self.buindingNameField.text forKey:@"builddatasSearchVo.buildingname"];
    [param setObject:self.manipulatorField.text forKey:@"builddatasSearchVo.owner"];
    [param setObject:self.inresponseField.text forKey:@"builddatasSearchVo.responsibleperson"];
    [param setObject:self.manipulatorTelField.text forKey:@"builddatasSearchVo.phone"];
    return param;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)chooseBuildingStructure{
    if (!self.structures) {
        [self commonAlertWithContent:@"出租房结构" choosenBlock:^(PropertyDictItemModel *model) {
            self.structureModel = model;
            self.buildingStructureField.text = self.structureModel.displayName;
        } getList:^(NSArray *array) {
            self.structures = array;
        }];
    }else{
        [self alertWithArray:self.usages choosenBock:^(PropertyDictItemModel *model) {
            self.structureModel = model;
            self.buildingStructureField.text = self.structureModel.displayName;
        }];
    }
}

#pragma mark - Table view data source

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 1) {
        [self chooseBuildingStructure];
    }
}

@end
